var _instance = null;

function Clazz(time) {
    this.name = 'ccf';
    this.time = time;
}

Clazz.prototype = {
    constructor: Clazz,
    show: function () {
        console.log(this.name + ":" + this.time);
    }
}

function getInstance(time){
    if (_instance === null) {
        _instance = new Clazz(time);
        console.log('new Clazz...');
    }
    return _instance;
}

/*
function getInstance2(time){

    function Clazz(time) {
        this.name = 'ccf';
        this.time = time;
    }

    Clazz.prototype = {
        constructor: Clazz,
        show: function () {
            console.log(this.name + ":" + this.time);
        }
    }

    this.getInstance = function () {
        if (_instance === null) {
            _instance = new Clazz(time);
            console.log('new Clazz...');
        }
        return _instance;
    }

    return this.getInstance();
}
*/

module.exports.getInstance = getInstance;